/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import java.sql.*;

/**
 *
 * @author phihai
 */
public class Database {
    
    private Connection conn;
       
    public Connection open() throws ClassNotFoundException, SQLException
    {
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        String url = "jdbc:sqlserver://localhost:1433;databaseName=WEBCH;user=sa;password=sa;";
        conn = DriverManager.getConnection(url);
        return conn;
    }
    
    public void close() throws SQLException
    {
        conn.close();
    }

}
